package com.yuzhihao.writejvm.format;

/**
 * A stack map frame is represented by a discriminated union, stack_map_frame, which consists of a one-byte tag, indicating which item of the union is in use, followed by zero or more bytes, giving more information about the tag.
 * @author yzh
 * @since 2021年12月14日14:19:06
 */
public enum StackMapFrameEnum {
    //
    same_frame(0,63,"SAME"),
    same_locals_1_stack_item_frame(64,127,"SAME_LOCALS_1_STACK_ITEM"),
    same_locals_1_stack_item_frame_extended(247,2,"SAME_LOCALS_1_STACK_ITEM_EXTENDED"),
    chop_frame(248,250,"CHOP"),
    same_frame_extended(251,251,"SAME_FRAME_EXTENDED"),
    append_frame(252,254,"APPEND"),
    full_frame(255,255,"FULL_FRAME")
    ;

    private final int start;
    private final int end;
    private final String type;

    StackMapFrameEnum(int start, int end, String type) {
        this.start = start;
        this.end = end;
        this.type = type;
    }

    public int getStart() {
        return start;
    }

    public int getEnd() {
        return end;
    }

    public String getType() {
        return type;
    }
}
